package com.maimao.user.client;

import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.Result;
import com.maimao.model.goods.Brand;
import com.maimao.model.user.Foot;
import com.maimao.user.client.factory.BrandFallBackFactory;
import com.maimao.user.client.factory.GoodsFallBackFactory;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 7:54 下午
 */
@RequestMapping("/goods/brand")
@FeignClient(contextId = "brandClient", value = ServiceContainer.GOODS_SERVICE, fallbackFactory = BrandFallBackFactory.class, configuration = FeignInterceptor.class)
public interface BrandClient {

    /**
     * 根据ID查询品牌名
     */
    @GetMapping("/client/name")
    Result<String> selectNameById(@RequestParam("id") Long id);

    @GetMapping("/client/queryByName")
    Result<Brand> selectByName(@RequestParam("name") String name);

    @PostMapping("/client/add")
    Result<Long> addBrand(@RequestBody Brand brand);


    @PostMapping("/queryBrandByShopId")
    public Result<Brand> queryBrandByShopId(@RequestParam("shopId") Long shopId);
}
